package tool;

import java.io.Serializable;

/**
 * @ClassName Student
 * @Description TODO
 * @Author LYJ
 * @Date 2018/12/24 10:01
 * @Verison 1.0
 **/
public class Student implements Serializable {

    private String name;

    private transient int age;

    private  transient String sex;

    public Student() {
    }

    public Student(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }

    private void writeObject(java.io.ObjectOutputStream s)
            throws java.io.IOException{
        s.defaultWriteObject();
        s.writeInt(this.age);
        s.writeObject(this.sex);
    }


    private void readObject(java.io.ObjectInputStream s)
            throws java.io.IOException, ClassNotFoundException {
        s.defaultReadObject();
        this.age = s.readInt();
        this.sex = (String) s.readObject();
    }
}
